


export default function toEditPage(pageFrom, cb, pk_psnjob) {
    // 如果是点击的新增按钮跳到修改页面，那么就弹出唯一性验证弹窗
    if (pageFrom === 'add') {
        this.setState({
            pageFrom: pageFrom,
            onlyInfoModalVisible: true,
            subTableEditable: true,
            disableUpload: false
        }, () => {
            cb && cb();
        });
    }
    // 如果是点击了修改按钮进入到修改页面，则直接跳到修改页面
    else if (pageFrom === 'modify') {
        this.checkDbClick(() => {
            this.setState({
                pageFrom: 'dbClick'
            }, () => {  
                this.getModifyData(() => {
                    this.setState({
                        page: 'add-new',
                        subTableEditable: true,
                        disableUpload: false,
                        pageFrom: 'modify'
                    }, () => {
                        cb && cb();
                    });
                    // 将按钮设置为修改页面的按钮
                    this.setButtonStatus2('addEditPage');
                });
            });
        }, pk_psnjob)
    }
    // 还有一种双击进入到修改页面的预览态的时候
    else if (pageFrom === 'dbClick') {
        this.setState({
            pageFrom: 'dbClick',
            disableUpload: true
        }, () => {
            this.getModifyData(() => {
                this.setState({
                    page: 'add-new'
                }, () => {
                    cb && cb();
                    this.cancelEdit();
                });
                this.setButtonStatus2('addEditPage');
            });
        });
    }
}